//hashMap.h
//with the help of Amir Roth
#ifndef __HASHMAP_H__
#define __HASHMAP_H__


#define CHECK_ALC_ERROR(var)    \
  if ((var)==NULL){perror("cant alloc"); _exit(EXIT_FAILURE);}


typedef struct en_s{
  void *val;
  int key;
}ENTRY;


typedef struct hm_s{
  int size;  
  ENTRY **entries;
}MAP;


MAP * createMap(int size);

//lookup with hash function, linear probe if collisions
int insert(MAP *map, int key, void *value);

//lookup value,almost same process as inserting
void * lookup(MAP *map, int key);

//same as lookup but removes
void * removeEntry(MAP *map, int key);

void freeMap(MAP* map);


#endif
